using System;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity;
using System.Linq;

namespace CarsManagement.Models
{
    public partial class DB : DbContext
    {
        public DB()
            : base("name=DB1")
        {
        }

        public virtual DbSet<infos> infos { get; set; }
        public virtual DbSet<typee> typee { get; set; }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Entity<infos>()
                .Property(e => e.Name)
                .IsUnicode(false);

            modelBuilder.Entity<infos>()
                .Property(e => e.Phonenum)
                .IsUnicode(false);

            modelBuilder.Entity<infos>()
                .Property(e => e.Number)
                .IsUnicode(false);

            modelBuilder.Entity<infos>()
                .Property(e => e.licence)
                .IsUnicode(false);

            modelBuilder.Entity<infos>()
                .Property(e => e.Addresss)
                .IsUnicode(false);

            modelBuilder.Entity<infos>()
                .Property(e => e.States)
                .IsUnicode(false);

            modelBuilder.Entity<typee>()
                .Property(e => e.CarType)
                .IsUnicode(false);

            modelBuilder.Entity<typee>()
                .HasMany(e => e.infos)
                .WithOptional(e => e.typee)
                .HasForeignKey(e => e.TypeId);
        }
    }
}
